<template>
	<view class="xzfx-timeline-item">
		<view class="left" :style="{color: iconColor}">
			<slot name="icon">
				<xzfx-icon size="40rpx" :iconName="icon"></xzfx-icon>
			</slot>
			<view v-if="line" class="line"></view>
		</view>
		
		<view class="right">
			<view v-if="placement === 'top'" class="timestamp">{{ timestamp }}</view>
			<view class="content" :class="{borderBottom: borderBottom}" :style="{paddingTop: placement === 'bottom' ? '0rpx' : 0}">
				<slot></slot>
			</view>
			<view v-if="placement === 'bottom'" class="timestamp">{{ timestamp }}</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		name: "xzfx-timeline-item",
		props:{
			icon: {
				type: String,
				default: "xzfx-icon-time"
			},
			iconColor: {
				type: String,
				default: "#999999"
			},
			timestamp: {
				type: String
			},
			placement: {
				type: String,
				default: "bottom"
			}
		},
		data() {
			return {
				line: false,
				borderBottom: false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.xzfx-timeline-item{
		display: flex;
		width: 100%;
		padding: 12rpx 0 15rpx 0;
		.left{
			display: inline-block;
			vertical-align: top;
			width: 55rpx;
			position: relative;
			
			.line{
				position: absolute;
				top: 45rpx;
				left: 18rpx;
				// width: 2rpx;
				height: calc(100% - 26rpx);
				border: 1rpx dashed #d1d1d1;
			}
		}
		.right{
			display: inline-block;
			vertical-align: top;
			width: calc(100% - 55rpx);
			.content{
				color: #333333;
				font-size: 32rpx;
				line-height: 34rpx;
				white-space: normal;
				padding-bottom: 20rpx;
			}
			.borderBottom{
				border-bottom: 1rpx solid #ecebee;
			}
			.timestamp{
				color: #666666;
				font-size: 30rpx;
				line-height: 50rpx;
				white-space: normal;
			}
		}
		
		
	}
</style>